﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_CM_GetAllLinkman]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_CM_GetAllLinkman];
GO
CREATE PROCEDURE [dbo].[sproc_CM_GetAllLinkman]

AS
    --SELECT UDS_Staff.Staff_ID,UDS_Staff.Staff_Name,UDS_CM_ClientContact_Linkman.ContactID FROM UDS_CM_ClientContact_Linkman,UDS_Staff 
    --WHERE UDS_CM_ClientContact_Linkman.LinkmanID=UDS_Staff.Staff_ID
    SELECT UDS_CM_Linkman.ID AS ID,UDS_CM_Linkman.Name,UDS_CM_Linkman.Gender,UDS_CM_Linkman.Mobile,UDS_CM_Linkman.LastContactTime,UDS_CM_ClientInfo.Name AS ClientName
    FROM UDS_CM_Linkman,UDS_CM_ClientInfo
    WHERE UDS_CM_Linkman.ClientID=UDS_CM_ClientInfo.ID